<style type="text/css">
body{background:#eee}
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
.weui_cell_hd {
    padding: 0.6rem;
	padding-left: 0;
}
.weui_cells_text {padding:0 10px;padding-top:10px}
p {
    margin: 0 0 2px;
}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: 3.6rem;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#25c376'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#25c376'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#25c376'}};
	border: 1px solid {{main.syscolor || '#25c376'}};
	border-radius:50%;
}
.arrow-top {
  width: 0;   
  height: 0;   
  border-left: 10px solid transparent; 
  border-right: 10px solid transparent;
  border-bottom: 10px solid #000; 
  font-size: 0;  
  line-height: 0;
  margin-left:1.3rem
}
.syscolor{color: #25c376;}
.label-default {
    background-color: #f5f7fb;
	color: #25c376;
}
.label-gray {
	line-height:2.2;
	background-color:#fff;
	border: 1px solid #999;
	color:#999;
	margin-right:0.3rem;
    font-size: 80%;
}
.label-gray.active {
	background-color:#25c376;
	color:#fff;
	border: 1px solid {{main.syscolor || '#25c376'}};
}
.yuyue-duan {background:#25c376;border: 0 solid #19b955;color:#fff;width:auto;border-radius: 2px;padding:5px 10px;height:auto;margin:2px;font-size:15px;text-align:center;}
.yuyue-duan.active{background:#f60}
.yuyue-duan span {width:100%;text-align:center}
.fui-navbar .buybtn  {padding-left:0.2rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:auto;font-weight:400;font-size:0.75rem;margin:0.2rem 0;padding: 0 0.5rem}
.fee-tagup {background:#25c376;color:#fff;width:auto;font-weight:400;font-size:0.6rem}
.fee-tag-nav {background:#25c376;}
.fee-tagup-nav {background:#25c376;}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'main'">
	<div class="fui-content">
	<div ng-include="sys_html('common/_peisong')"></div>
	<div class="jy-content">
		<div class="fui-cell-group radius">
            <div ng-repeat="item in pagedata.post.goods" class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-label" style="width:auto;padding-right:0.4rem">
                    <div style="width:4.5rem;margin:0 auto">
					<img class="round" style="border-radius:0.3rem;height:3.5rem;width:4.5rem" ng-src="{{tomedia(item.image) || '../addons/jy_djhome/resource/images/xm.png'}}">
					</div>
                </div>
                <div class="fui-cell-text" style="margin-top:0">
                    <div class="title" style="font-size:0.75rem">
						<span class="bold">{{item.title}}<span>
					</div>
                    <div class="gray" style="margin-top:0.6rem;height:auto;font-size:0.5rem">
						<span style="color:red">
						<span style="font-size:0.8rem">{{item.price}}</span>元/人次
						</span>
						<i class="icon icon-shijian syscolor" style="font-size:0.6rem;padding-left:0.2rem"></i>
						<span>{{item.times}}分钟</span>
					</div>
                </div>
				<div class="fui-cell-remark noremark">
					<div class="fui-number small" style="right:0">
							<div class="minus" ng-click="pagedata.minus(item.id,$index)"><i class="icon icon-subtract" style="font-size:0.7rem"></i></div>
							{{pagedata.post.goods[item.id].total||0}}
							<div class="plus" ng-click="pagedata.plus(item.id,item)"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></div>
					</div>
				</div>
			</div>
			<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    服务技师
                </div>
				<div class="fui-cell-remark noremark">
					{{pagedata.worker.name}}
				</div>
			</div>
			<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    服务时间
                </div>
				<div class="fui-cell-remark" ng-click="pagedata.gotoshowtime()">
					<span style="color:#f60">{{pagedata.post.day}} {{pagedata.post.time}}</span>
				</div>
			</div>
			<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    出行方式
                </div>
				<div class="fui-cell-remark noremark">
					<span ng-click="pagedata.post.chetype=1;pagedata.get_chefee()" class="label label-gray {{pagedata.post.chetype==1?'active':''}}">滴滴/出租</span>
					<span ng-click="pagedata.post.chetype=2;pagedata.get_chefee()" class="label label-gray {{pagedata.post.chetype==2?'active':''}}">公交/地铁</span>
				</div>
			</div>
			<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    车费
                </div>
				<div class="fui-cell-remark noremark">
					<span ng-if="pagedata.post.addressid" style="color:red">￥{{pagedata.post.chefee||'0.00'}}</span>
					<span ng-if="!pagedata.post.addressid" style="color:#999;font-size:0.5rem">根据出行方式，服务地址来计算</span>
				</div>
			</div>
			<!--<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    优惠券
                </div>
				<div class="fui-cell-remark">
					请选择
				</div>
			</div>-->
			<div class="fui-cell" style="padding:0.5rem">
                <div class="fui-cell-info" style="width:auto;padding-right:0.4rem">
                    备注
                </div>
				<div class="fui-cell-remark" ng-click="pagedata.showremark=true">
					{{pagedata.post.remark||'选填'}}
				</div>
			</div>
		</div>
		</div>
		<div class="fui-navbar-tip" ng-if="pagedata.buyxieyi.isopen==1" style="height:1.8rem">
		<div class="fui-cellone sm" style="padding:0">
			<div class="fui-cellone-info" style='line-height:1.4;font-size:0.7rem'>
				<span class="text"><input type="checkbox" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked" name="checkbox" class="fui-radio fui-radio-danger cartmode check-item"/></span>
				<span class="text" ng-click="pagedata.show_xieyi=true;">请先阅读【{{pagedata.buyxieyi.title || '订单须知'}}】</span>
			</div>
		</div>
		</div>
		<div class="fui-navbar order-create-checkout">
			<a href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
				<span  class="text-danger bigprice">&yen; 
					<span class="totalprice syscolor" style="font-size:1.2rem">{{price(pagedata.post.totalprice) || '0.00'}}</span>
				</span>
				<div class="gray" style="margin-top:-0.5rem;font-size:0.6rem">另需车费￥{{pagedata.post.chefee||'0.00'}}</div>
			</a>
			<a ng-if="!pagedata.order_id && pagedata.post.totalprice>0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="pagedata.pay_submit(pagedata.post,'jy_djhome/book/post/','jy_djhome/order//status=1')" >
				<div class="fee-tagup-nav">
					确认提交
				</div>
			</a>
			<a ng-if="pagedata.order_id" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="access_json('jy_djhome/fuwu.order/')" >
				<div class="fee-tag-nav">
					查看订单
				</div>
			</a>
		</div>
</div>
</div>
<div ng-if="pagedata.showtotime" class="popup">
		<style>
		.jyui_cell_col .red {
			background: red;
		}
		</style>
			<div class="popup-body">
			<div class="popup-bottom" style="border-radius:0.2rem;">
				<i class="closed icon icon-cuowu" style="top:-2rem" ng-click="pagedata.showtotime=false"></i>
				<div class="fui-tab-scroll" style="background:#f2f2f2;height:2.3rem;">
					<div ng-repeat="item in pagedata.work_timedata" style="height:2rem;line-height:2rem;padding:0 0.5rem" ng-class="{'item':1,'on':pagedata.post.day==item.day}" ng-click="pagedata.post.day=item.day">
					<span>{{item.xinq}} {{item.riqi}}</span>
					</div>
				</div>
				<div class="col-jy" style="padding:0.2rem">
					<div ng-repeat="hour in pagedata.work_hours" class="jy-3" ng-if="pagedata.nowtime<hour.timestamp || pagedata.nowmonthday!=pagedata.post.day">
						<div ng-if="hour.isman!=1" ng-class="{'yuyue-duan':1,'active':pagedata.post.time == hour.start}" ng-click="pagedata.post.time=hour.start;pagedata.post.time2=hour.timev;">
							<div>{{hour.start}}~{{hour.end}}</div>
							<div class="clear"></div>
						</div>
						<div ng-if="hour.isman==1" class="yuyue-duan delete">
							<div>{{hour.start}}~{{hour.end}}</div>
							<div class="clear"></div>
						</div>
					</div>
				</div>
			</div>
			</div>
</div>
<div ng-if="pagedata.showremark" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="padding-bottom:3rem">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:105%;" ng-click="pagedata.showremark=false"></i>
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">留言</div>
				</div>
				<div class="fui-cell">
					<div class="fui-cell-info c000">
						<textarea rows="5" placeholder="50字以内（选填）" ng-model="pagedata.post.remark"></textarea>
					</div>
				</div>
			</div>
			<div class="fui-navbar" style="padding:0.35rem 1rem;background:none">
				<a href="javascript:;" ng-click="pagedata.showremark=false" class="btn btn-danger btn-banf" style="margin:0;width:100%">确定</a>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="font-size:1.2rem;top:105%;" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.buyxieyi.title||'订单须知'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.buyxieyi.content)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.checked=true" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
scope.main.syscolor='#25c376';
scope.pagedata.post.serve_time=new Date(scope.pagedata.post.serve_time);
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	if(scope.pagedata.yuejiemid>0 && !scope.pagedata.post.yuejie_select){
		scope.pagedata.yuejie_show=true
		scope.$evalAsync();
		return false;
	}
	scope.post_json(post_url,post,function(result){
		if(result.order_id){
			scope.pagedata.order_id=result.order_id;
			scope.$evalAsync();
			scope.tool.pay(result.pay_id,function(res){
					if(res.type=='success'){
						scope.message('支付成功！','success',complete_url);
					}else{
						scope.message('支付失败！','success',complete_url);
					}
			},'','',complete_url,complete_url);
		}
	});
}
scope.pagedata.upprice=function(){
	var groupid=scope.pagedata.post.groupid
	var pid=scope.pagedata.post.pid
	scope.pagedata.post.nowitem=scope.pagedata.groups[groupid].list[pid];
	scope.pagedata.post.nowitem=scope.pagedata.post.nowitem?scope.pagedata.post.nowitem:{}
	scope.pagedata.post.diyfields=scope.pagedata.post.nowitem.diyfields;
	scope.pagedata.post.vip_price=scope.pagedata.post.nowitem.vip_price;
	scope.pagedata.post.price=scope.pagedata.post.nowitem.price;
	scope.pagedata.post.order_types=scope.pagedata.post.nowitem.order_types;
	scope.pagedata.post.totalprice=scope.pagedata.post.nowitem.price;
	if(scope.pagedata.pluginset.is_dianfee==1 && scope.pagedata.post.type==1){
		scope.pagedata.post.totalprice=0;
	}
	scope.pagedata.post.oldpid=scope.pagedata.post.pid;
	console.log(scope.pagedata.post);
	scope.$evalAsync();
}
scope.pagedata.gotoshowtime=function(){
	scope.get('jy_djhome/book/get_work_time/worker_id='+scope.pagedata.post.worker_id,function(res){
		scope.pagedata.work_timedata=res.days;
		scope.pagedata.work_hours=res.hours;
		scope.pagedata.showtotime=true;
		res.hours[0]=res.hours[0]?res.hours[0]:{};
		scope.pagedata.post.time=res.hours[0].start
		scope.$evalAsync();
	});
}
//减少
scope.pagedata.minus=function(goodsid,index){
	var g = scope.pagedata.post.goods[goodsid]
	if(g.total<=0){
		return false;
	}
	g.total--;
	scope.pagedata.post.totalprice -=g.price*1;
	if(g.total<=0){
	}
	scope.pagedata.post.goods[goodsid]=g;
	scope.$evalAsync();
}
//增加
scope.pagedata.plus=function(goodsid,nowgoods){
	scope.pagedata.post.goods=scope.pagedata.post.goods?scope.pagedata.post.goods:{}
	var g = scope.pagedata.post.goods[goodsid]
	console.log(goodsid);
	if(!g){
		g={
			'title':nowgoods.title,
			'image':nowgoods.image,
			'id':nowgoods.id,
			'price':nowgoods.price,
			'times':nowgoods.times,
			'total':1
		};
	}else{
		g.total++;
	}
	scope.pagedata.post.totalprice=scope.pagedata.post.totalprice?scope.pagedata.post.totalprice:0;
	scope.pagedata.post.totalprice +=g.price*1;
	console.log(scope.pagedata.post.totalprice);
	scope.pagedata.post.goods[goodsid]=g;
	scope.$evalAsync();
}
//get_chefee
scope.pagedata.get_chefee=function(){
	scope.get('jy_djhome/book/get_chefee/addressid='+scope.pagedata.post.addressid+'&chetype='+scope.pagedata.post.chetype+'&worker_id='+scope.pagedata.post.worker_id,function(freight){
		scope.pagedata.post.chefee=freight.chefee;
		scope.pagedata.post.juli=freight.juli;
		scope.pagedata.edit_address=0;
		scope.pagedata.modal_address=0;
		scope.$evalAsync();
	});
}
</script>